﻿#if CONVERT_MODELS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static MCSkin3D.ModelLoader;

namespace MCSkin3D.Models.Convert
{
	public class ModelEnderman : ModelBiped
	{
		/** Is the enderman carrying a block? */
		public boolean isCarrying;

		/** Is the enderman attacking an entity? */
		public boolean isAttacking;

		public ModelEnderman(float p_i46305_1_) :
			base(0.0F, -14.0F, 64, 32)
		{
			this.boxList.Remove(this.bipedHeadwear);
			this.boxList.Remove(this.bipedBody);
			this.boxList.Remove(this.bipedRightArm);
			this.boxList.Remove(this.bipedLeftArm);
			this.boxList.Remove(this.bipedRightLeg);
			this.boxList.Remove(this.bipedLeftLeg);

			float f = -14.0F;
			this.bipedHeadwear = new ModelRenderer(this, 0, 16, ModelPart.Helmet);
			this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i46305_1_ - 0.5F, "Jaw");
			this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + f, 0.0F);
			this.bipedBody = new ModelRenderer(this, 32, 16, ModelPart.Chest);
			this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, p_i46305_1_, "Body");
			this.bipedBody.setRotationPoint(0.0F, 0.0F + f, 0.0F);
			this.bipedRightArm = new ModelRenderer(this, 56, 0, ModelPart.RightArm);
			this.bipedRightArm.addBox(-1.0F, -2.0F, -1.0F, 2, 30, 2, p_i46305_1_, "Right Arm");
			this.bipedRightArm.setRotationPoint(-3.0F, 2.0F + f, 0.0F);
			this.bipedLeftArm = new ModelRenderer(this, 56, 0, ModelPart.LeftArm);
			this.bipedLeftArm.mirror = true;
			this.bipedLeftArm.addBox(-1.0F, -2.0F, -1.0F, 2, 30, 2, p_i46305_1_, "Left Arm");
			this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + f, 0.0F);
			this.bipedRightLeg = new ModelRenderer(this, 56, 0, ModelPart.RightLeg);
			this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 30, 2, p_i46305_1_, "Right Leg");
			this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F + f, 0.0F);
			this.bipedLeftLeg = new ModelRenderer(this, 56, 0, ModelPart.LeftLeg);
			this.bipedLeftLeg.mirror = true;
			this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 30, 2, p_i46305_1_, "Left Leg");
			this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F + f, 0.0F);
		}

		/**
		 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
		 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
		 * "far" arms and legs can swing at most.
		 */
		public override void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
		{
			base.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
			this.bipedHead.showModel = true;
			float f = -14.0F;
			this.bipedBody.rotateAngleX = 0.0F;
			this.bipedBody.rotationPointY = f;
			this.bipedBody.rotationPointZ = -0.0F;
			this.bipedRightLeg.rotateAngleX -= 0.0F;
			this.bipedLeftLeg.rotateAngleX -= 0.0F;
			this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX * 0.5D);
			this.bipedLeftArm.rotateAngleX = (float)((double)this.bipedLeftArm.rotateAngleX * 0.5D);
			this.bipedRightLeg.rotateAngleX = (float)((double)this.bipedRightLeg.rotateAngleX * 0.5D);
			this.bipedLeftLeg.rotateAngleX = (float)((double)this.bipedLeftLeg.rotateAngleX * 0.5D);
			float f1 = 0.4F;

			if (this.bipedRightArm.rotateAngleX > f1)
			{
				this.bipedRightArm.rotateAngleX = f1;
			}

			if (this.bipedLeftArm.rotateAngleX > f1)
			{
				this.bipedLeftArm.rotateAngleX = f1;
			}

			if (this.bipedRightArm.rotateAngleX < -f1)
			{
				this.bipedRightArm.rotateAngleX = -f1;
			}

			if (this.bipedLeftArm.rotateAngleX < -f1)
			{
				this.bipedLeftArm.rotateAngleX = -f1;
			}

			if (this.bipedRightLeg.rotateAngleX > f1)
			{
				this.bipedRightLeg.rotateAngleX = f1;
			}

			if (this.bipedLeftLeg.rotateAngleX > f1)
			{
				this.bipedLeftLeg.rotateAngleX = f1;
			}

			if (this.bipedRightLeg.rotateAngleX < -f1)
			{
				this.bipedRightLeg.rotateAngleX = -f1;
			}

			if (this.bipedLeftLeg.rotateAngleX < -f1)
			{
				this.bipedLeftLeg.rotateAngleX = -f1;
			}

			if (this.isCarrying)
			{
				this.bipedRightArm.rotateAngleX = -0.5F;
				this.bipedLeftArm.rotateAngleX = -0.5F;
				this.bipedRightArm.rotateAngleZ = 0.05F;
				this.bipedLeftArm.rotateAngleZ = -0.05F;
			}

			this.bipedRightArm.rotationPointZ = 0.0F;
			this.bipedLeftArm.rotationPointZ = 0.0F;
			this.bipedRightLeg.rotationPointZ = 0.0F;
			this.bipedLeftLeg.rotationPointZ = 0.0F;
			this.bipedRightLeg.rotationPointY = 9.0F + f;
			this.bipedLeftLeg.rotationPointY = 9.0F + f;
			this.bipedHead.rotationPointZ = -0.0F;
			this.bipedHead.rotationPointY = f + 1.0F;
			this.bipedHeadwear.rotationPointX = this.bipedHead.rotationPointX;
			this.bipedHeadwear.rotationPointY = this.bipedHead.rotationPointY;
			this.bipedHeadwear.rotationPointZ = this.bipedHead.rotationPointZ;
			this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX;
			this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY;
			this.bipedHeadwear.rotateAngleZ = this.bipedHead.rotateAngleZ;

			if (this.isAttacking)
			{
				float f2 = 1.0F;
				this.bipedHead.rotationPointY -= f2 * 5.0F;
			}
		}
	}
}
#endif